/*
 * @Author: xiaosihan 
 * @Date: 2024-10-06 20:56:49 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2024-10-06 20:57:18
 */

import { autorun } from "mobx";
import { ReactNode, useEffect, useRef, useState } from "react";
import styles from "./factoryQuotation.module.less";
import FactoryHeader from "../FactoryHeader/FactoryHeader";
import factoryQuotationStore from "./factoryQuotationStore";
import { Button } from "antd";

interface Iprops {
    children?: ReactNode
}

// 厂商报价请求
export default function FactoryQuotation(props: Iprops) {

    const dom = useRef<HTMLDivElement | null>(null);
    const [data, setData] = useState({});
    const [category, setCategory] = useState(factoryQuotationStore.category);
    useEffect(() => {

    }, []);

    useEffect(() => autorun(() => {
        setCategory(factoryQuotationStore.category);
    }, { delay: 10 }), []);

    return (
        <div ref={dom} className={styles.factoryQuotation} >
            {/* 工厂端的公共头 */}
            <FactoryHeader />
            <div className={styles.title} >收到的报价请求</div>
            <div className={styles.btns} >
                <Button size="small" type={category === "" ? "primary" : "default"} onClick={() => factoryQuotationStore.setCategory("")} >全部RFQ</Button>
                <Button size="small" type={category === "await_price" ? "primary" : "default"} onClick={() => factoryQuotationStore.setCategory("await_price")}>待定价</Button>
                <Button size="small" type={category === "price" ? "primary" : "default"} onClick={() => factoryQuotationStore.setCategory("price")} >已定价</Button>
            </div>


        </div>
    );

}